package com.bhs.sansonglogistics.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;

import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.utils.MyUtils;

/**
 * 红包领取
 */
public class RedPacketDialog extends Dialog {
    
    public RedPacketDialog(@NonNull Context context, int themeResId) {
        super(context, R.style.MyBottomDialogStyle);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_red_packet);
        //获取当前Activity所在的窗体
        Window dialogWindow = getWindow();
        //设置Dialog从窗体底部弹出
        dialogWindow.setGravity(Gravity.CENTER);
        //获得窗体的属性
        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
        lp.width = MyUtils.getScreenWidth(getContext()) * 7 / 10;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        dialogWindow.setAttributes(lp); //将属性设置给窗体
        setCanceledOnTouchOutside(false);
        initView();
    }

    private void initView() {
    }
}
